<!DOCTYPE html><html lang="en" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>你未必知道的49个CSS知识点小动画 | 孙志豪的博客</title><meta name="author" content="孙志豪"><meta name="copyright" content="孙志豪"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="你未必知道的49个CSS知识点小动画01.【负边距】💘负边距的效果。注意左右负边距表现并不一致。左为负时，是左移，右为负时，是左拉。上下与左右类似 02.【shape-outside】❤不要自以为是了。你以为自己是方的，在别人眼里你却是圆的 03.【BFC应用】💓BFC应用之阻止外边距合并（margin collapsing） 04.【BFC应用】💔BFC应用之消除浮动的影响 05.【fl">
<meta property="og:type" content="article">
<meta property="og:title" content="你未必知道的49个CSS知识点小动画">
<meta property="og:url" content="https://szhihao.gitee.io/2022/10/11/11-%E5%89%8D%E7%AB%AF%EF%BC%88CSS%E6%89%8B%E5%86%99%E7%AF%87%EF%BC%89/%E4%BD%A0%E6%9C%AA%E5%BF%85%E7%9F%A5%E9%81%93%E7%9A%8449%E4%B8%AACSS%E7%9F%A5%E8%AF%86%E7%82%B9%E5%B0%8F%E5%8A%A8%E7%94%BB/index.html">
<meta property="og:site_name" content="孙志豪的博客">
<meta property="og:description" content="你未必知道的49个CSS知识点小动画01.【负边距】💘负边距的效果。注意左右负边距表现并不一致。左为负时，是左移，右为负时，是左拉。上下与左右类似 02.【shape-outside】❤不要自以为是了。你以为自己是方的，在别人眼里你却是圆的 03.【BFC应用】💓BFC应用之阻止外边距合并（margin collapsing） 04.【BFC应用】💔BFC应用之消除浮动的影响 05.【fl">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://szhihao.gitee.io/img/%E5%A4%A9%E7%A9%BA.jpeg">
<meta property="article:published_time" content="2022-10-11T12:01:36.000Z">
<meta property="article:modified_time" content="2022-10-12T01:58:50.245Z">
<meta property="article:author" content="孙志豪">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://szhihao.gitee.io/img/%E5%A4%A9%E7%A9%BA.jpeg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://szhihao.gitee.io/2022/10/11/11-%E5%89%8D%E7%AB%AF%EF%BC%88CSS%E6%89%8B%E5%86%99%E7%AF%87%EF%BC%89/%E4%BD%A0%E6%9C%AA%E5%BF%85%E7%9F%A5%E9%81%93%E7%9A%8449%E4%B8%AACSS%E7%9F%A5%E8%AF%86%E7%82%B9%E5%B0%8F%E5%8A%A8%E7%94%BB/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","languages":{"hits_empty":"We didn't find any results for the search: ${query}"}},
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: 'Copy successfully',
    error: 'Copy error',
    noSupport: 'The browser does not support'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: 'Just',
    min: 'minutes ago',
    hour: 'hours ago',
    day: 'days ago',
    month: 'months ago'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '你未必知道的49个CSS知识点小动画',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2022-10-12 09:58:50'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 6.3.0"></head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "" data-lazy-src="/img/%E5%A4%B4%E5%83%8F.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">44</div></a><a href="/tags/"><div class="headline">Tags</div><div class="length-num">1</div></a><a href="/categories/"><div class="headline">Categories</div><div class="length-num">15</div></a></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fa fa-graduation-cap"></i><span> 博文</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/categories/"><i class="fa-fw fa fa-archive"></i><span> 分类</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/archives/"><i class="fa-fw fa fa-folder-open"></i><span> 归档</span></a></li></ul></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 生活</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/photos/"><i class="fa-fw fa fa-camera-retro"></i><span> 相册</span></a></li><li><a class="site-page child" href="/music/"><i class="fa-fw fa fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 影视</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/links/"><i class="fa-fw fa fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/comment/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于笔者</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('/img/%E5%A4%A9%E7%A9%BA.jpeg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">孙志豪的博客</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> Search</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fa fa-graduation-cap"></i><span> 博文</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/categories/"><i class="fa-fw fa fa-archive"></i><span> 分类</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fa fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/archives/"><i class="fa-fw fa fa-folder-open"></i><span> 归档</span></a></li></ul></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 生活</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/photos/"><i class="fa-fw fa fa-camera-retro"></i><span> 相册</span></a></li><li><a class="site-page child" href="/music/"><i class="fa-fw fa fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 影视</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/links/"><i class="fa-fw fa fa-link"></i><span> 友链</span></a></div><div class="menus_item"><a class="site-page" href="/comment/"><i class="fa-fw fa fa-paper-plane"></i><span> 留言板</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于笔者</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">你未必知道的49个CSS知识点小动画</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">Created</span><time class="post-meta-date-created" datetime="2022-10-11T12:01:36.000Z" title="Created 2022-10-11 20:01:36">2022-10-11</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2022-10-12T01:58:50.245Z" title="Updated 2022-10-12 09:58:50">2022-10-12</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E5%89%8D%E7%AB%AF%EF%BC%88CSS%E6%89%8B%E5%86%99%E7%AF%87%EF%BC%89/">前端（CSS手写篇）</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="你未必知道的49个CSS知识点小动画"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">Post View:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><hr>
<h1 id="你未必知道的49个CSS知识点小动画"><a href="#你未必知道的49个CSS知识点小动画" class="headerlink" title="你未必知道的49个CSS知识点小动画"></a>你未必知道的49个CSS知识点小动画</h1><h3 id="01-【负边距】💘负边距的效果。注意左右负边距表现并不一致。左为负时，是左移，右为负时，是左拉。上下与左右类似"><a href="#01-【负边距】💘负边距的效果。注意左右负边距表现并不一致。左为负时，是左移，右为负时，是左拉。上下与左右类似" class="headerlink" title="01.【负边距】💘负边距的效果。注意左右负边距表现并不一致。左为负时，是左移，右为负时，是左拉。上下与左右类似"></a>01.【负边距】💘负边距的效果。注意左右负边距表现并不一致。左为负时，是左移，右为负时，是左拉。上下与左右类似</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/30/16c3f20e0bfc9f24~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="02-【shape-outside】❤不要自以为是了。你以为自己是方的，在别人眼里你却是圆的"><a href="#02-【shape-outside】❤不要自以为是了。你以为自己是方的，在别人眼里你却是圆的" class="headerlink" title="02.【shape-outside】❤不要自以为是了。你以为自己是方的，在别人眼里你却是圆的"></a>02.【shape-outside】❤不要自以为是了。你以为自己是方的，在别人眼里你却是圆的</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d4d63509b4f0~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="03-【BFC应用】💓BFC应用之阻止外边距合并（margin-collapsing）"><a href="#03-【BFC应用】💓BFC应用之阻止外边距合并（margin-collapsing）" class="headerlink" title="03.【BFC应用】💓BFC应用之阻止外边距合并（margin collapsing）"></a>03.【BFC应用】💓BFC应用之阻止外边距合并（margin collapsing）</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d4f1395d5cc2~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="04-【BFC应用】💔BFC应用之消除浮动的影响"><a href="#04-【BFC应用】💔BFC应用之消除浮动的影响" class="headerlink" title="04.【BFC应用】💔BFC应用之消除浮动的影响"></a>04.【BFC应用】💔BFC应用之消除浮动的影响</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d4f22d3173c9~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="05-【flex不为人知的特性之一】💕flex布局下margin-auto的神奇用法"><a href="#05-【flex不为人知的特性之一】💕flex布局下margin-auto的神奇用法" class="headerlink" title="05.【flex不为人知的特性之一】💕flex布局下margin:auto的神奇用法"></a>05.【flex不为人知的特性之一】💕flex布局下margin:auto的神奇用法</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d4f579c4de52~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="06-【flex不为人知的特性之二】💖flex布局，当flex-grow之和小于1时，只能按比例分配部分剩余空间，而不是全部"><a href="#06-【flex不为人知的特性之二】💖flex布局，当flex-grow之和小于1时，只能按比例分配部分剩余空间，而不是全部" class="headerlink" title="06.【flex不为人知的特性之二】💖flex布局，当flex-grow之和小于1时，只能按比例分配部分剩余空间，而不是全部"></a>06.【flex不为人知的特性之二】💖flex布局，当flex-grow之和小于1时，只能按比例分配部分剩余空间，而不是全部</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d4f642feaa48~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="07-【input的宽度】💗并不是给元素设置display-block就会自动填充父元素宽度。input-就是个例外，其默认宽度取决于size特性的值"><a href="#07-【input的宽度】💗并不是给元素设置display-block就会自动填充父元素宽度。input-就是个例外，其默认宽度取决于size特性的值" class="headerlink" title="07.【input的宽度】💗并不是给元素设置display:block就会自动填充父元素宽度。input 就是个例外，其默认宽度取决于size特性的值"></a>07.【input的宽度】💗并不是给元素设置display:block就会自动填充父元素宽度。input 就是个例外，其默认宽度取决于size特性的值</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d4f6fef0a871~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="08-【定位特性】💙绝对定位和固定定位时，同时设置-left-和-right-等同于隐式地设置宽度"><a href="#08-【定位特性】💙绝对定位和固定定位时，同时设置-left-和-right-等同于隐式地设置宽度" class="headerlink" title="08.【定位特性】💙绝对定位和固定定位时，同时设置 left 和 right 等同于隐式地设置宽度"></a>08.【定位特性】💙绝对定位和固定定位时，同时设置 left 和 right 等同于隐式地设置宽度</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d4f7f76af224~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="09-【层叠上下文】💚层叠上下文：小辈就是小辈，再厉害也只是个小辈"><a href="#09-【层叠上下文】💚层叠上下文：小辈就是小辈，再厉害也只是个小辈" class="headerlink" title="09.【层叠上下文】💚层叠上下文：小辈就是小辈，再厉害也只是个小辈"></a>09.【层叠上下文】💚层叠上下文：小辈就是小辈，再厉害也只是个小辈</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d4f89327d07d~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="10-【粘性定位】💛position-sticky，粘性定位要起作用，需要设置最后滞留位置。chrome有bug，firefox完美"><a href="#10-【粘性定位】💛position-sticky，粘性定位要起作用，需要设置最后滞留位置。chrome有bug，firefox完美" class="headerlink" title="10.【粘性定位】💛position:sticky，粘性定位要起作用，需要设置最后滞留位置。chrome有bug，firefox完美"></a>10.【粘性定位】💛position:sticky，粘性定位要起作用，需要设置最后滞留位置。chrome有bug，firefox完美</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d4f943e923f9~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="11-【相邻兄弟选择器】💜相邻兄弟选择器之常用场景"><a href="#11-【相邻兄弟选择器】💜相邻兄弟选择器之常用场景" class="headerlink" title="11.【相邻兄弟选择器】💜相邻兄弟选择器之常用场景"></a>11.【相邻兄弟选择器】💜相邻兄弟选择器之常用场景</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d4f9f7e99a80~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="12-【模态框】🖤要使模态框背景透明，用rgba是一种简单方式"><a href="#12-【模态框】🖤要使模态框背景透明，用rgba是一种简单方式" class="headerlink" title="12.【模态框】🖤要使模态框背景透明，用rgba是一种简单方式"></a>12.【模态框】🖤要使模态框背景透明，用rgba是一种简单方式</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d4fb360585bf~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="13-【三角形】💝css绘制三角形的原理"><a href="#13-【三角形】💝css绘制三角形的原理" class="headerlink" title="13.【三角形】💝css绘制三角形的原理"></a>13.【三角形】💝css绘制三角形的原理</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d4fc3a5fd756~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="14-【table布局】💞display-table实现多列等高布局"><a href="#14-【table布局】💞display-table实现多列等高布局" class="headerlink" title="14.【table布局】💞display:table实现多列等高布局"></a>14.【table布局】💞display:table实现多列等高布局</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d4fd6cc88002~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="15-【颜色对比度】❣蓝底红字，由于颜色对比度比较低，故而看不清，因此不是好的配色方案😂"><a href="#15-【颜色对比度】❣蓝底红字，由于颜色对比度比较低，故而看不清，因此不是好的配色方案😂" class="headerlink" title="15.【颜色对比度】❣蓝底红字，由于颜色对比度比较低，故而看不清，因此不是好的配色方案😂"></a>15.【颜色对比度】❣蓝底红字，由于颜色对比度比较低，故而看不清，因此不是好的配色方案😂</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d4ff199cd6d0~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="16-【定宽高比】♥css实现定宽高比的原理：padding的百分比是相对于其包含块的宽度，而不是高度"><a href="#16-【定宽高比】♥css实现定宽高比的原理：padding的百分比是相对于其包含块的宽度，而不是高度" class="headerlink" title="16.【定宽高比】♥css实现定宽高比的原理：padding的百分比是相对于其包含块的宽度，而不是高度"></a>16.【定宽高比】♥css实现定宽高比的原理：padding的百分比是相对于其包含块的宽度，而不是高度</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d5000087a8d0~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="17-【动画方向】🐹动画方向可以选择alternate，去回交替进行"><a href="#17-【动画方向】🐹动画方向可以选择alternate，去回交替进行" class="headerlink" title="17.【动画方向】🐹动画方向可以选择alternate，去回交替进行"></a>17.【动画方向】🐹动画方向可以选择alternate，去回交替进行</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d501284cbcff~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="18-【线性渐变应用】🐮css绘制彩带的原理"><a href="#18-【线性渐变应用】🐮css绘制彩带的原理" class="headerlink" title="18.【线性渐变应用】🐮css绘制彩带的原理"></a>18.【线性渐变应用】🐮css绘制彩带的原理</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d5021ac977bb~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="19-【隐藏文本】🐯隐藏文字内容的两种办法"><a href="#19-【隐藏文本】🐯隐藏文字内容的两种办法" class="headerlink" title="19.【隐藏文本】🐯隐藏文字内容的两种办法"></a>19.【隐藏文本】🐯隐藏文字内容的两种办法</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d50308c15117~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="20-【居中】🐰实现居中的一种简单方式"><a href="#20-【居中】🐰实现居中的一种简单方式" class="headerlink" title="20.【居中】🐰实现居中的一种简单方式"></a>20.【居中】🐰实现居中的一种简单方式</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d503b2a29f31~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="21-【角向渐变】🐲新的渐变：角向渐变。可以用来实现饼图"><a href="#21-【角向渐变】🐲新的渐变：角向渐变。可以用来实现饼图" class="headerlink" title="21.【角向渐变】🐲新的渐变：角向渐变。可以用来实现饼图"></a>21.【角向渐变】🐲新的渐变：角向渐变。可以用来实现饼图</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d50444a314cc~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="22-【背景位置百分比】🐍background-position百分比的正确理解方式：图片自身的百分比位置与容器同样的百分比位置重合"><a href="#22-【背景位置百分比】🐍background-position百分比的正确理解方式：图片自身的百分比位置与容器同样的百分比位置重合" class="headerlink" title="22.【背景位置百分比】🐍background-position百分比的正确理解方式：图片自身的百分比位置与容器同样的百分比位置重合"></a>22.【背景位置百分比】🐍background-position百分比的正确理解方式：图片自身的百分比位置与容器同样的百分比位置重合</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d5051a3e4f1a~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="23-【背景重复新值】🐴background-repeat新属性值：round和space。前者表示凑个整，后者表示留点缝"><a href="#23-【背景重复新值】🐴background-repeat新属性值：round和space。前者表示凑个整，后者表示留点缝" class="headerlink" title="23.【背景重复新值】🐴background-repeat新属性值：round和space。前者表示凑个整，后者表示留点缝"></a>23.【背景重复新值】🐴background-repeat新属性值：round和space。前者表示凑个整，后者表示留点缝</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d505c290f434~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="24-【背景附着】🐐background-attachment指定背景如何附着在容器上，注意其属性值local和fixed的使用"><a href="#24-【背景附着】🐐background-attachment指定背景如何附着在容器上，注意其属性值local和fixed的使用" class="headerlink" title="24.【背景附着】🐐background-attachment指定背景如何附着在容器上，注意其属性值local和fixed的使用"></a>24.【背景附着】🐐background-attachment指定背景如何附着在容器上，注意其属性值local和fixed的使用</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d50761cdf47c~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="25-【动画延时】🐵动画添加延迟时间可以使步调不一致"><a href="#25-【动画延时】🐵动画添加延迟时间可以使步调不一致" class="headerlink" title="25.【动画延时】🐵动画添加延迟时间可以使步调不一致"></a>25.【动画延时】🐵动画添加延迟时间可以使步调不一致</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d5089051201a~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="26-【outline使用】🐔可以使用outline来描边，不占地方，它甚至可以在里面"><a href="#26-【outline使用】🐔可以使用outline来描边，不占地方，它甚至可以在里面" class="headerlink" title="26.【outline使用】🐔可以使用outline来描边，不占地方，它甚至可以在里面"></a>26.【outline使用】🐔可以使用outline来描边，不占地方，它甚至可以在里面</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d5092af1be9f~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="27【背景定位】🐶当固定背景不随元素滚动时，背景定位是相对于视口的"><a href="#27【背景定位】🐶当固定背景不随元素滚动时，背景定位是相对于视口的" class="headerlink" title="27【背景定位】🐶当固定背景不随元素滚动时，背景定位是相对于视口的"></a>27【背景定位】🐶当固定背景不随元素滚动时，背景定位是相对于视口的</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d509e173f40b~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="28【tab-size】🐷浏览器默认显示tab为8个空格，tab-size可以指定空格长度"><a href="#28【tab-size】🐷浏览器默认显示tab为8个空格，tab-size可以指定空格长度" class="headerlink" title="28【tab-size】🐷浏览器默认显示tab为8个空格，tab-size可以指定空格长度"></a>28【tab-size】🐷浏览器默认显示tab为8个空格，tab-size可以指定空格长度</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d50ac1d21e4b~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="29【动画暂停】🥝CSS动画其实是可以暂停的"><a href="#29【动画暂停】🥝CSS动画其实是可以暂停的" class="headerlink" title="29【动画暂停】🥝CSS动画其实是可以暂停的"></a>29【动画暂停】🥝CSS动画其实是可以暂停的</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d50bcc76349f~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="30【object-fit】🍓图片在指定尺寸后，可以设置object-fit为contain或cover保持比例"><a href="#30【object-fit】🍓图片在指定尺寸后，可以设置object-fit为contain或cover保持比例" class="headerlink" title="30【object-fit】🍓图片在指定尺寸后，可以设置object-fit为contain或cover保持比例"></a>30【object-fit】🍓图片在指定尺寸后，可以设置object-fit为contain或cover保持比例</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d50c9c447a1a~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="31【鼠标状态】🍒按钮禁用时，不要忘了设置鼠标状态"><a href="#31【鼠标状态】🍒按钮禁用时，不要忘了设置鼠标状态" class="headerlink" title="31【鼠标状态】🍒按钮禁用时，不要忘了设置鼠标状态"></a>31【鼠标状态】🍒按钮禁用时，不要忘了设置鼠标状态</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d50df31971f3~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="32【背景虚化】🍑使用CSS滤镜实现背景虚化"><a href="#32【背景虚化】🍑使用CSS滤镜实现背景虚化" class="headerlink" title="32【背景虚化】🍑使用CSS滤镜实现背景虚化"></a>32【背景虚化】🍑使用CSS滤镜实现背景虚化</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d50e8cadbfc4~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="33【fill-available】🍏设置宽度为fill-available，可以使inline-block像block那样填充整个空间"><a href="#33【fill-available】🍏设置宽度为fill-available，可以使inline-block像block那样填充整个空间" class="headerlink" title="33【fill-available】🍏设置宽度为fill-available，可以使inline-block像block那样填充整个空间"></a>33【fill-available】🍏设置宽度为fill-available，可以使inline-block像block那样填充整个空间</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d50f694c5878~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="34【fit-content】🍎设置宽度为fit-content，可以使block像inline-block那样实现收缩宽度包裹内容的效果"><a href="#34【fit-content】🍎设置宽度为fit-content，可以使block像inline-block那样实现收缩宽度包裹内容的效果" class="headerlink" title="34【fit-content】🍎设置宽度为fit-content，可以使block像inline-block那样实现收缩宽度包裹内容的效果"></a>34【fit-content】🍎设置宽度为fit-content，可以使block像inline-block那样实现收缩宽度包裹内容的效果</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d510015a44fc~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="35【自定义属性】🍋CSS自定义属性的简单使用"><a href="#35【自定义属性】🍋CSS自定义属性的简单使用" class="headerlink" title="35【自定义属性】🍋CSS自定义属性的简单使用"></a>35【自定义属性】🍋CSS自定义属性的简单使用</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d510b10d731e~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="36【min-content-x2F-max-content】🍍可以设置宽度为min-content和max-content，前者让内容尽可能地收缩，后者让内容尽可能地展开"><a href="#36【min-content-x2F-max-content】🍍可以设置宽度为min-content和max-content，前者让内容尽可能地收缩，后者让内容尽可能地展开" class="headerlink" title="36【min-content&#x2F;max-content】🍍可以设置宽度为min-content和max-content，前者让内容尽可能地收缩，后者让内容尽可能地展开"></a>36【min-content&#x2F;max-content】🍍可以设置宽度为min-content和max-content，前者让内容尽可能地收缩，后者让内容尽可能地展开</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d511d0ea8214~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="37【进度条】🍊使用渐变，一个div实现进度条"><a href="#37【进度条】🍊使用渐变，一个div实现进度条" class="headerlink" title="37【进度条】🍊使用渐变，一个div实现进度条"></a>37【进度条】🍊使用渐变，一个div实现进度条</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d51329e83a68~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="38【打印】🍉可以在打印网页时，设置page相关属性。比如page-break-before属性来表示是否需要另起新页"><a href="#38【打印】🍉可以在打印网页时，设置page相关属性。比如page-break-before属性来表示是否需要另起新页" class="headerlink" title="38【打印】🍉可以在打印网页时，设置page相关属性。比如page-break-before属性来表示是否需要另起新页"></a>38【打印】🍉可以在打印网页时，设置page相关属性。比如page-break-before属性来表示是否需要另起新页</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d514c5cc6473~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="39【逐帧动画】🍌利用CSS精灵实现逐帧动画"><a href="#39【逐帧动画】🍌利用CSS精灵实现逐帧动画" class="headerlink" title="39【逐帧动画】🍌利用CSS精灵实现逐帧动画"></a>39【逐帧动画】🍌利用CSS精灵实现逐帧动画</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d515ef18723a~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="40【resize】🍐普通元素也可以像textarea那样resize"><a href="#40【resize】🍐普通元素也可以像textarea那样resize" class="headerlink" title="40【resize】🍐普通元素也可以像textarea那样resize"></a>40【resize】🍐普通元素也可以像textarea那样resize</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d516e61e2885~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="41【面包屑】🍇使用before伪元素实现面包屑"><a href="#41【面包屑】🍇使用before伪元素实现面包屑" class="headerlink" title="41【面包屑】🍇使用before伪元素实现面包屑"></a>41【面包屑】🍇使用before伪元素实现面包屑</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d517babad7d8~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="42【sticky-footer】🍈使用grid布局实现sticky-footer"><a href="#42【sticky-footer】🍈使用grid布局实现sticky-footer" class="headerlink" title="42【sticky footer】🍈使用grid布局实现sticky footer"></a>42【sticky footer】🍈使用grid布局实现sticky footer</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d518ab2c7e0f~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="43【动画填充状态】🍅CSS可以设置动画开始前和结束时所保持的状态"><a href="#43【动画填充状态】🍅CSS可以设置动画开始前和结束时所保持的状态" class="headerlink" title="43【动画填充状态】🍅CSS可以设置动画开始前和结束时所保持的状态"></a>43【动画填充状态】🍅CSS可以设置动画开始前和结束时所保持的状态</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d5195e6bea48~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="44【动画负延迟】🥑CSS动画可以设置延迟时间为负数，表示动画仿佛开始前就已经运行过了那么长时间"><a href="#44【动画负延迟】🥑CSS动画可以设置延迟时间为负数，表示动画仿佛开始前就已经运行过了那么长时间" class="headerlink" title="44【动画负延迟】🥑CSS动画可以设置延迟时间为负数，表示动画仿佛开始前就已经运行过了那么长时间"></a>44【动画负延迟】🥑CSS动画可以设置延迟时间为负数，表示动画仿佛开始前就已经运行过了那么长时间</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d51a09f353d9~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="45【过渡】🍆爱的魔力转圈圈"><a href="#45【过渡】🍆爱的魔力转圈圈" class="headerlink" title="45【过渡】🍆爱的魔力转圈圈"></a>45【过渡】🍆爱的魔力转圈圈</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d51b12aca6ff~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="46【动画案例】🍬水波效果原理"><a href="#46【动画案例】🍬水波效果原理" class="headerlink" title="46【动画案例】🍬水波效果原理"></a>46【动画案例】🍬水波效果原理</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d51c0ada68da~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="47【动画案例】🌸CSS弹球动画效果的原理"><a href="#47【动画案例】🌸CSS弹球动画效果的原理" class="headerlink" title="47【动画案例】🌸CSS弹球动画效果的原理"></a>47【动画案例】🌸CSS弹球动画效果的原理</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d51d2d34833e~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="48【outline】🌻outline属性的妙用"><a href="#48【outline】🌻outline属性的妙用" class="headerlink" title="48【outline】🌻outline属性的妙用"></a>48【outline】🌻outline属性的妙用</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d51e76666d72~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<h3 id="49【grid】💕火狐浏览器grid布局检测器"><a href="#49【grid】💕火狐浏览器grid布局检测器" class="headerlink" title="49【grid】💕火狐浏览器grid布局检测器"></a>49【grid】💕火狐浏览器grid布局检测器</h3><p><img src= "" data-lazy-src="https://p1-jj.byteimg.com/tos-cn-i-t2oaga2asx/gold-user-assets/2019/7/29/16c3d52039c1b1da~tplv-t2oaga2asx-watermark.awebp" alt="img"></p>
<p>希望有所帮助。</p>
<hr>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">Author: </span><span class="post-copyright-info"><a href="https://szhihao.gitee.io">孙志豪</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">Link: </span><span class="post-copyright-info"><a href="https://szhihao.gitee.io/2022/10/11/11-%E5%89%8D%E7%AB%AF%EF%BC%88CSS%E6%89%8B%E5%86%99%E7%AF%87%EF%BC%89/%E4%BD%A0%E6%9C%AA%E5%BF%85%E7%9F%A5%E9%81%93%E7%9A%8449%E4%B8%AACSS%E7%9F%A5%E8%AF%86%E7%82%B9%E5%B0%8F%E5%8A%A8%E7%94%BB/">https://szhihao.gitee.io/2022/10/11/11-%E5%89%8D%E7%AB%AF%EF%BC%88CSS%E6%89%8B%E5%86%99%E7%AF%87%EF%BC%89/%E4%BD%A0%E6%9C%AA%E5%BF%85%E7%9F%A5%E9%81%93%E7%9A%8449%E4%B8%AACSS%E7%9F%A5%E8%AF%86%E7%82%B9%E5%B0%8F%E5%8A%A8%E7%94%BB/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">Copyright Notice: </span><span class="post-copyright-info">All articles in this blog are licensed under <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> unless stating additionally.</span></div></div><div class="tag_share"><div class="post-meta__tag-list"></div><div class="post_share"><div class="social-share" data-image="/img/%E5%A4%A9%E7%A9%BA.jpeg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2022/10/11/08-%E6%A0%B8%E5%BF%83js%EF%BC%88%E8%BE%93%E5%87%BA%E9%A2%98%EF%BC%89/%E8%BE%93%E5%87%BA%E7%AF%87/"><img class="prev-cover" src= "" data-lazy-src="/img/%E5%A4%A9%E7%A9%BA.jpeg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">Previous Post</div><div class="prev_info">高频前端面试题汇总之代码输出结果篇2</div></div></a></div><div class="next-post pull-right"><a href="/2022/10/11/09-%E6%A0%B8%E5%BF%83js%EF%BC%88%E5%8E%9F%E7%90%86%E7%AF%87%EF%BC%89/js%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E6%A2%B3%E7%90%86/"><img class="next-cover" src= "" data-lazy-src="/img/%E5%A4%A9%E7%A9%BA.jpeg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">Next Post</div><div class="next_info">JS 问题梳理</div></div></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src= "" data-lazy-src="/img/%E5%A4%B4%E5%83%8F.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">孙志豪</div><div class="author-info__description">吾日三省吾身：为人谋而不忠乎？与朋友交而不信乎？传不习乎？</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">44</div></a><a href="/tags/"><div class="headline">Tags</div><div class="length-num">1</div></a><a href="/categories/"><div class="headline">Categories</div><div class="length-num">15</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://gitee.com/szhihao/szhihao"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://gitee.com/szhihao/szhihao" target="_blank" title="Gitee"><i class="fab fa-github"></i></a><a class="social-icon" href="https://blog.csdn.net/qq_54753561" target="_blank" title="CSDN"><i class="fa fa-book-open"></i></a><a class="social-icon" href="mailto:zhihaomail@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>Announcement</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>Catalog</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BD%A0%E6%9C%AA%E5%BF%85%E7%9F%A5%E9%81%93%E7%9A%8449%E4%B8%AACSS%E7%9F%A5%E8%AF%86%E7%82%B9%E5%B0%8F%E5%8A%A8%E7%94%BB"><span class="toc-number">1.</span> <span class="toc-text">你未必知道的49个CSS知识点小动画</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#01-%E3%80%90%E8%B4%9F%E8%BE%B9%E8%B7%9D%E3%80%91%F0%9F%92%98%E8%B4%9F%E8%BE%B9%E8%B7%9D%E7%9A%84%E6%95%88%E6%9E%9C%E3%80%82%E6%B3%A8%E6%84%8F%E5%B7%A6%E5%8F%B3%E8%B4%9F%E8%BE%B9%E8%B7%9D%E8%A1%A8%E7%8E%B0%E5%B9%B6%E4%B8%8D%E4%B8%80%E8%87%B4%E3%80%82%E5%B7%A6%E4%B8%BA%E8%B4%9F%E6%97%B6%EF%BC%8C%E6%98%AF%E5%B7%A6%E7%A7%BB%EF%BC%8C%E5%8F%B3%E4%B8%BA%E8%B4%9F%E6%97%B6%EF%BC%8C%E6%98%AF%E5%B7%A6%E6%8B%89%E3%80%82%E4%B8%8A%E4%B8%8B%E4%B8%8E%E5%B7%A6%E5%8F%B3%E7%B1%BB%E4%BC%BC"><span class="toc-number">1.0.1.</span> <span class="toc-text">01.【负边距】💘负边距的效果。注意左右负边距表现并不一致。左为负时，是左移，右为负时，是左拉。上下与左右类似</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#02-%E3%80%90shape-outside%E3%80%91%E2%9D%A4%E4%B8%8D%E8%A6%81%E8%87%AA%E4%BB%A5%E4%B8%BA%E6%98%AF%E4%BA%86%E3%80%82%E4%BD%A0%E4%BB%A5%E4%B8%BA%E8%87%AA%E5%B7%B1%E6%98%AF%E6%96%B9%E7%9A%84%EF%BC%8C%E5%9C%A8%E5%88%AB%E4%BA%BA%E7%9C%BC%E9%87%8C%E4%BD%A0%E5%8D%B4%E6%98%AF%E5%9C%86%E7%9A%84"><span class="toc-number">1.0.2.</span> <span class="toc-text">02.【shape-outside】❤不要自以为是了。你以为自己是方的，在别人眼里你却是圆的</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#03-%E3%80%90BFC%E5%BA%94%E7%94%A8%E3%80%91%F0%9F%92%93BFC%E5%BA%94%E7%94%A8%E4%B9%8B%E9%98%BB%E6%AD%A2%E5%A4%96%E8%BE%B9%E8%B7%9D%E5%90%88%E5%B9%B6%EF%BC%88margin-collapsing%EF%BC%89"><span class="toc-number">1.0.3.</span> <span class="toc-text">03.【BFC应用】💓BFC应用之阻止外边距合并（margin collapsing）</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#04-%E3%80%90BFC%E5%BA%94%E7%94%A8%E3%80%91%F0%9F%92%94BFC%E5%BA%94%E7%94%A8%E4%B9%8B%E6%B6%88%E9%99%A4%E6%B5%AE%E5%8A%A8%E7%9A%84%E5%BD%B1%E5%93%8D"><span class="toc-number">1.0.4.</span> <span class="toc-text">04.【BFC应用】💔BFC应用之消除浮动的影响</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#05-%E3%80%90flex%E4%B8%8D%E4%B8%BA%E4%BA%BA%E7%9F%A5%E7%9A%84%E7%89%B9%E6%80%A7%E4%B9%8B%E4%B8%80%E3%80%91%F0%9F%92%95flex%E5%B8%83%E5%B1%80%E4%B8%8Bmargin-auto%E7%9A%84%E7%A5%9E%E5%A5%87%E7%94%A8%E6%B3%95"><span class="toc-number">1.0.5.</span> <span class="toc-text">05.【flex不为人知的特性之一】💕flex布局下margin:auto的神奇用法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#06-%E3%80%90flex%E4%B8%8D%E4%B8%BA%E4%BA%BA%E7%9F%A5%E7%9A%84%E7%89%B9%E6%80%A7%E4%B9%8B%E4%BA%8C%E3%80%91%F0%9F%92%96flex%E5%B8%83%E5%B1%80%EF%BC%8C%E5%BD%93flex-grow%E4%B9%8B%E5%92%8C%E5%B0%8F%E4%BA%8E1%E6%97%B6%EF%BC%8C%E5%8F%AA%E8%83%BD%E6%8C%89%E6%AF%94%E4%BE%8B%E5%88%86%E9%85%8D%E9%83%A8%E5%88%86%E5%89%A9%E4%BD%99%E7%A9%BA%E9%97%B4%EF%BC%8C%E8%80%8C%E4%B8%8D%E6%98%AF%E5%85%A8%E9%83%A8"><span class="toc-number">1.0.6.</span> <span class="toc-text">06.【flex不为人知的特性之二】💖flex布局，当flex-grow之和小于1时，只能按比例分配部分剩余空间，而不是全部</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#07-%E3%80%90input%E7%9A%84%E5%AE%BD%E5%BA%A6%E3%80%91%F0%9F%92%97%E5%B9%B6%E4%B8%8D%E6%98%AF%E7%BB%99%E5%85%83%E7%B4%A0%E8%AE%BE%E7%BD%AEdisplay-block%E5%B0%B1%E4%BC%9A%E8%87%AA%E5%8A%A8%E5%A1%AB%E5%85%85%E7%88%B6%E5%85%83%E7%B4%A0%E5%AE%BD%E5%BA%A6%E3%80%82input-%E5%B0%B1%E6%98%AF%E4%B8%AA%E4%BE%8B%E5%A4%96%EF%BC%8C%E5%85%B6%E9%BB%98%E8%AE%A4%E5%AE%BD%E5%BA%A6%E5%8F%96%E5%86%B3%E4%BA%8Esize%E7%89%B9%E6%80%A7%E7%9A%84%E5%80%BC"><span class="toc-number">1.0.7.</span> <span class="toc-text">07.【input的宽度】💗并不是给元素设置display:block就会自动填充父元素宽度。input 就是个例外，其默认宽度取决于size特性的值</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#08-%E3%80%90%E5%AE%9A%E4%BD%8D%E7%89%B9%E6%80%A7%E3%80%91%F0%9F%92%99%E7%BB%9D%E5%AF%B9%E5%AE%9A%E4%BD%8D%E5%92%8C%E5%9B%BA%E5%AE%9A%E5%AE%9A%E4%BD%8D%E6%97%B6%EF%BC%8C%E5%90%8C%E6%97%B6%E8%AE%BE%E7%BD%AE-left-%E5%92%8C-right-%E7%AD%89%E5%90%8C%E4%BA%8E%E9%9A%90%E5%BC%8F%E5%9C%B0%E8%AE%BE%E7%BD%AE%E5%AE%BD%E5%BA%A6"><span class="toc-number">1.0.8.</span> <span class="toc-text">08.【定位特性】💙绝对定位和固定定位时，同时设置 left 和 right 等同于隐式地设置宽度</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#09-%E3%80%90%E5%B1%82%E5%8F%A0%E4%B8%8A%E4%B8%8B%E6%96%87%E3%80%91%F0%9F%92%9A%E5%B1%82%E5%8F%A0%E4%B8%8A%E4%B8%8B%E6%96%87%EF%BC%9A%E5%B0%8F%E8%BE%88%E5%B0%B1%E6%98%AF%E5%B0%8F%E8%BE%88%EF%BC%8C%E5%86%8D%E5%8E%89%E5%AE%B3%E4%B9%9F%E5%8F%AA%E6%98%AF%E4%B8%AA%E5%B0%8F%E8%BE%88"><span class="toc-number">1.0.9.</span> <span class="toc-text">09.【层叠上下文】💚层叠上下文：小辈就是小辈，再厉害也只是个小辈</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#10-%E3%80%90%E7%B2%98%E6%80%A7%E5%AE%9A%E4%BD%8D%E3%80%91%F0%9F%92%9Bposition-sticky%EF%BC%8C%E7%B2%98%E6%80%A7%E5%AE%9A%E4%BD%8D%E8%A6%81%E8%B5%B7%E4%BD%9C%E7%94%A8%EF%BC%8C%E9%9C%80%E8%A6%81%E8%AE%BE%E7%BD%AE%E6%9C%80%E5%90%8E%E6%BB%9E%E7%95%99%E4%BD%8D%E7%BD%AE%E3%80%82chrome%E6%9C%89bug%EF%BC%8Cfirefox%E5%AE%8C%E7%BE%8E"><span class="toc-number">1.0.10.</span> <span class="toc-text">10.【粘性定位】💛position:sticky，粘性定位要起作用，需要设置最后滞留位置。chrome有bug，firefox完美</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#11-%E3%80%90%E7%9B%B8%E9%82%BB%E5%85%84%E5%BC%9F%E9%80%89%E6%8B%A9%E5%99%A8%E3%80%91%F0%9F%92%9C%E7%9B%B8%E9%82%BB%E5%85%84%E5%BC%9F%E9%80%89%E6%8B%A9%E5%99%A8%E4%B9%8B%E5%B8%B8%E7%94%A8%E5%9C%BA%E6%99%AF"><span class="toc-number">1.0.11.</span> <span class="toc-text">11.【相邻兄弟选择器】💜相邻兄弟选择器之常用场景</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#12-%E3%80%90%E6%A8%A1%E6%80%81%E6%A1%86%E3%80%91%F0%9F%96%A4%E8%A6%81%E4%BD%BF%E6%A8%A1%E6%80%81%E6%A1%86%E8%83%8C%E6%99%AF%E9%80%8F%E6%98%8E%EF%BC%8C%E7%94%A8rgba%E6%98%AF%E4%B8%80%E7%A7%8D%E7%AE%80%E5%8D%95%E6%96%B9%E5%BC%8F"><span class="toc-number">1.0.12.</span> <span class="toc-text">12.【模态框】🖤要使模态框背景透明，用rgba是一种简单方式</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#13-%E3%80%90%E4%B8%89%E8%A7%92%E5%BD%A2%E3%80%91%F0%9F%92%9Dcss%E7%BB%98%E5%88%B6%E4%B8%89%E8%A7%92%E5%BD%A2%E7%9A%84%E5%8E%9F%E7%90%86"><span class="toc-number">1.0.13.</span> <span class="toc-text">13.【三角形】💝css绘制三角形的原理</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#14-%E3%80%90table%E5%B8%83%E5%B1%80%E3%80%91%F0%9F%92%9Edisplay-table%E5%AE%9E%E7%8E%B0%E5%A4%9A%E5%88%97%E7%AD%89%E9%AB%98%E5%B8%83%E5%B1%80"><span class="toc-number">1.0.14.</span> <span class="toc-text">14.【table布局】💞display:table实现多列等高布局</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#15-%E3%80%90%E9%A2%9C%E8%89%B2%E5%AF%B9%E6%AF%94%E5%BA%A6%E3%80%91%E2%9D%A3%E8%93%9D%E5%BA%95%E7%BA%A2%E5%AD%97%EF%BC%8C%E7%94%B1%E4%BA%8E%E9%A2%9C%E8%89%B2%E5%AF%B9%E6%AF%94%E5%BA%A6%E6%AF%94%E8%BE%83%E4%BD%8E%EF%BC%8C%E6%95%85%E8%80%8C%E7%9C%8B%E4%B8%8D%E6%B8%85%EF%BC%8C%E5%9B%A0%E6%AD%A4%E4%B8%8D%E6%98%AF%E5%A5%BD%E7%9A%84%E9%85%8D%E8%89%B2%E6%96%B9%E6%A1%88%F0%9F%98%82"><span class="toc-number">1.0.15.</span> <span class="toc-text">15.【颜色对比度】❣蓝底红字，由于颜色对比度比较低，故而看不清，因此不是好的配色方案😂</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#16-%E3%80%90%E5%AE%9A%E5%AE%BD%E9%AB%98%E6%AF%94%E3%80%91%E2%99%A5css%E5%AE%9E%E7%8E%B0%E5%AE%9A%E5%AE%BD%E9%AB%98%E6%AF%94%E7%9A%84%E5%8E%9F%E7%90%86%EF%BC%9Apadding%E7%9A%84%E7%99%BE%E5%88%86%E6%AF%94%E6%98%AF%E7%9B%B8%E5%AF%B9%E4%BA%8E%E5%85%B6%E5%8C%85%E5%90%AB%E5%9D%97%E7%9A%84%E5%AE%BD%E5%BA%A6%EF%BC%8C%E8%80%8C%E4%B8%8D%E6%98%AF%E9%AB%98%E5%BA%A6"><span class="toc-number">1.0.16.</span> <span class="toc-text">16.【定宽高比】♥css实现定宽高比的原理：padding的百分比是相对于其包含块的宽度，而不是高度</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#17-%E3%80%90%E5%8A%A8%E7%94%BB%E6%96%B9%E5%90%91%E3%80%91%F0%9F%90%B9%E5%8A%A8%E7%94%BB%E6%96%B9%E5%90%91%E5%8F%AF%E4%BB%A5%E9%80%89%E6%8B%A9alternate%EF%BC%8C%E5%8E%BB%E5%9B%9E%E4%BA%A4%E6%9B%BF%E8%BF%9B%E8%A1%8C"><span class="toc-number">1.0.17.</span> <span class="toc-text">17.【动画方向】🐹动画方向可以选择alternate，去回交替进行</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#18-%E3%80%90%E7%BA%BF%E6%80%A7%E6%B8%90%E5%8F%98%E5%BA%94%E7%94%A8%E3%80%91%F0%9F%90%AEcss%E7%BB%98%E5%88%B6%E5%BD%A9%E5%B8%A6%E7%9A%84%E5%8E%9F%E7%90%86"><span class="toc-number">1.0.18.</span> <span class="toc-text">18.【线性渐变应用】🐮css绘制彩带的原理</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#19-%E3%80%90%E9%9A%90%E8%97%8F%E6%96%87%E6%9C%AC%E3%80%91%F0%9F%90%AF%E9%9A%90%E8%97%8F%E6%96%87%E5%AD%97%E5%86%85%E5%AE%B9%E7%9A%84%E4%B8%A4%E7%A7%8D%E5%8A%9E%E6%B3%95"><span class="toc-number">1.0.19.</span> <span class="toc-text">19.【隐藏文本】🐯隐藏文字内容的两种办法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#20-%E3%80%90%E5%B1%85%E4%B8%AD%E3%80%91%F0%9F%90%B0%E5%AE%9E%E7%8E%B0%E5%B1%85%E4%B8%AD%E7%9A%84%E4%B8%80%E7%A7%8D%E7%AE%80%E5%8D%95%E6%96%B9%E5%BC%8F"><span class="toc-number">1.0.20.</span> <span class="toc-text">20.【居中】🐰实现居中的一种简单方式</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#21-%E3%80%90%E8%A7%92%E5%90%91%E6%B8%90%E5%8F%98%E3%80%91%F0%9F%90%B2%E6%96%B0%E7%9A%84%E6%B8%90%E5%8F%98%EF%BC%9A%E8%A7%92%E5%90%91%E6%B8%90%E5%8F%98%E3%80%82%E5%8F%AF%E4%BB%A5%E7%94%A8%E6%9D%A5%E5%AE%9E%E7%8E%B0%E9%A5%BC%E5%9B%BE"><span class="toc-number">1.0.21.</span> <span class="toc-text">21.【角向渐变】🐲新的渐变：角向渐变。可以用来实现饼图</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#22-%E3%80%90%E8%83%8C%E6%99%AF%E4%BD%8D%E7%BD%AE%E7%99%BE%E5%88%86%E6%AF%94%E3%80%91%F0%9F%90%8Dbackground-position%E7%99%BE%E5%88%86%E6%AF%94%E7%9A%84%E6%AD%A3%E7%A1%AE%E7%90%86%E8%A7%A3%E6%96%B9%E5%BC%8F%EF%BC%9A%E5%9B%BE%E7%89%87%E8%87%AA%E8%BA%AB%E7%9A%84%E7%99%BE%E5%88%86%E6%AF%94%E4%BD%8D%E7%BD%AE%E4%B8%8E%E5%AE%B9%E5%99%A8%E5%90%8C%E6%A0%B7%E7%9A%84%E7%99%BE%E5%88%86%E6%AF%94%E4%BD%8D%E7%BD%AE%E9%87%8D%E5%90%88"><span class="toc-number">1.0.22.</span> <span class="toc-text">22.【背景位置百分比】🐍background-position百分比的正确理解方式：图片自身的百分比位置与容器同样的百分比位置重合</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#23-%E3%80%90%E8%83%8C%E6%99%AF%E9%87%8D%E5%A4%8D%E6%96%B0%E5%80%BC%E3%80%91%F0%9F%90%B4background-repeat%E6%96%B0%E5%B1%9E%E6%80%A7%E5%80%BC%EF%BC%9Around%E5%92%8Cspace%E3%80%82%E5%89%8D%E8%80%85%E8%A1%A8%E7%A4%BA%E5%87%91%E4%B8%AA%E6%95%B4%EF%BC%8C%E5%90%8E%E8%80%85%E8%A1%A8%E7%A4%BA%E7%95%99%E7%82%B9%E7%BC%9D"><span class="toc-number">1.0.23.</span> <span class="toc-text">23.【背景重复新值】🐴background-repeat新属性值：round和space。前者表示凑个整，后者表示留点缝</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#24-%E3%80%90%E8%83%8C%E6%99%AF%E9%99%84%E7%9D%80%E3%80%91%F0%9F%90%90background-attachment%E6%8C%87%E5%AE%9A%E8%83%8C%E6%99%AF%E5%A6%82%E4%BD%95%E9%99%84%E7%9D%80%E5%9C%A8%E5%AE%B9%E5%99%A8%E4%B8%8A%EF%BC%8C%E6%B3%A8%E6%84%8F%E5%85%B6%E5%B1%9E%E6%80%A7%E5%80%BClocal%E5%92%8Cfixed%E7%9A%84%E4%BD%BF%E7%94%A8"><span class="toc-number">1.0.24.</span> <span class="toc-text">24.【背景附着】🐐background-attachment指定背景如何附着在容器上，注意其属性值local和fixed的使用</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#25-%E3%80%90%E5%8A%A8%E7%94%BB%E5%BB%B6%E6%97%B6%E3%80%91%F0%9F%90%B5%E5%8A%A8%E7%94%BB%E6%B7%BB%E5%8A%A0%E5%BB%B6%E8%BF%9F%E6%97%B6%E9%97%B4%E5%8F%AF%E4%BB%A5%E4%BD%BF%E6%AD%A5%E8%B0%83%E4%B8%8D%E4%B8%80%E8%87%B4"><span class="toc-number">1.0.25.</span> <span class="toc-text">25.【动画延时】🐵动画添加延迟时间可以使步调不一致</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#26-%E3%80%90outline%E4%BD%BF%E7%94%A8%E3%80%91%F0%9F%90%94%E5%8F%AF%E4%BB%A5%E4%BD%BF%E7%94%A8outline%E6%9D%A5%E6%8F%8F%E8%BE%B9%EF%BC%8C%E4%B8%8D%E5%8D%A0%E5%9C%B0%E6%96%B9%EF%BC%8C%E5%AE%83%E7%94%9A%E8%87%B3%E5%8F%AF%E4%BB%A5%E5%9C%A8%E9%87%8C%E9%9D%A2"><span class="toc-number">1.0.26.</span> <span class="toc-text">26.【outline使用】🐔可以使用outline来描边，不占地方，它甚至可以在里面</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#27%E3%80%90%E8%83%8C%E6%99%AF%E5%AE%9A%E4%BD%8D%E3%80%91%F0%9F%90%B6%E5%BD%93%E5%9B%BA%E5%AE%9A%E8%83%8C%E6%99%AF%E4%B8%8D%E9%9A%8F%E5%85%83%E7%B4%A0%E6%BB%9A%E5%8A%A8%E6%97%B6%EF%BC%8C%E8%83%8C%E6%99%AF%E5%AE%9A%E4%BD%8D%E6%98%AF%E7%9B%B8%E5%AF%B9%E4%BA%8E%E8%A7%86%E5%8F%A3%E7%9A%84"><span class="toc-number">1.0.27.</span> <span class="toc-text">27【背景定位】🐶当固定背景不随元素滚动时，背景定位是相对于视口的</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#28%E3%80%90tab-size%E3%80%91%F0%9F%90%B7%E6%B5%8F%E8%A7%88%E5%99%A8%E9%BB%98%E8%AE%A4%E6%98%BE%E7%A4%BAtab%E4%B8%BA8%E4%B8%AA%E7%A9%BA%E6%A0%BC%EF%BC%8Ctab-size%E5%8F%AF%E4%BB%A5%E6%8C%87%E5%AE%9A%E7%A9%BA%E6%A0%BC%E9%95%BF%E5%BA%A6"><span class="toc-number">1.0.28.</span> <span class="toc-text">28【tab-size】🐷浏览器默认显示tab为8个空格，tab-size可以指定空格长度</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#29%E3%80%90%E5%8A%A8%E7%94%BB%E6%9A%82%E5%81%9C%E3%80%91%F0%9F%A5%9DCSS%E5%8A%A8%E7%94%BB%E5%85%B6%E5%AE%9E%E6%98%AF%E5%8F%AF%E4%BB%A5%E6%9A%82%E5%81%9C%E7%9A%84"><span class="toc-number">1.0.29.</span> <span class="toc-text">29【动画暂停】🥝CSS动画其实是可以暂停的</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#30%E3%80%90object-fit%E3%80%91%F0%9F%8D%93%E5%9B%BE%E7%89%87%E5%9C%A8%E6%8C%87%E5%AE%9A%E5%B0%BA%E5%AF%B8%E5%90%8E%EF%BC%8C%E5%8F%AF%E4%BB%A5%E8%AE%BE%E7%BD%AEobject-fit%E4%B8%BAcontain%E6%88%96cover%E4%BF%9D%E6%8C%81%E6%AF%94%E4%BE%8B"><span class="toc-number">1.0.30.</span> <span class="toc-text">30【object-fit】🍓图片在指定尺寸后，可以设置object-fit为contain或cover保持比例</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#31%E3%80%90%E9%BC%A0%E6%A0%87%E7%8A%B6%E6%80%81%E3%80%91%F0%9F%8D%92%E6%8C%89%E9%92%AE%E7%A6%81%E7%94%A8%E6%97%B6%EF%BC%8C%E4%B8%8D%E8%A6%81%E5%BF%98%E4%BA%86%E8%AE%BE%E7%BD%AE%E9%BC%A0%E6%A0%87%E7%8A%B6%E6%80%81"><span class="toc-number">1.0.31.</span> <span class="toc-text">31【鼠标状态】🍒按钮禁用时，不要忘了设置鼠标状态</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#32%E3%80%90%E8%83%8C%E6%99%AF%E8%99%9A%E5%8C%96%E3%80%91%F0%9F%8D%91%E4%BD%BF%E7%94%A8CSS%E6%BB%A4%E9%95%9C%E5%AE%9E%E7%8E%B0%E8%83%8C%E6%99%AF%E8%99%9A%E5%8C%96"><span class="toc-number">1.0.32.</span> <span class="toc-text">32【背景虚化】🍑使用CSS滤镜实现背景虚化</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#33%E3%80%90fill-available%E3%80%91%F0%9F%8D%8F%E8%AE%BE%E7%BD%AE%E5%AE%BD%E5%BA%A6%E4%B8%BAfill-available%EF%BC%8C%E5%8F%AF%E4%BB%A5%E4%BD%BFinline-block%E5%83%8Fblock%E9%82%A3%E6%A0%B7%E5%A1%AB%E5%85%85%E6%95%B4%E4%B8%AA%E7%A9%BA%E9%97%B4"><span class="toc-number">1.0.33.</span> <span class="toc-text">33【fill-available】🍏设置宽度为fill-available，可以使inline-block像block那样填充整个空间</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#34%E3%80%90fit-content%E3%80%91%F0%9F%8D%8E%E8%AE%BE%E7%BD%AE%E5%AE%BD%E5%BA%A6%E4%B8%BAfit-content%EF%BC%8C%E5%8F%AF%E4%BB%A5%E4%BD%BFblock%E5%83%8Finline-block%E9%82%A3%E6%A0%B7%E5%AE%9E%E7%8E%B0%E6%94%B6%E7%BC%A9%E5%AE%BD%E5%BA%A6%E5%8C%85%E8%A3%B9%E5%86%85%E5%AE%B9%E7%9A%84%E6%95%88%E6%9E%9C"><span class="toc-number">1.0.34.</span> <span class="toc-text">34【fit-content】🍎设置宽度为fit-content，可以使block像inline-block那样实现收缩宽度包裹内容的效果</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#35%E3%80%90%E8%87%AA%E5%AE%9A%E4%B9%89%E5%B1%9E%E6%80%A7%E3%80%91%F0%9F%8D%8BCSS%E8%87%AA%E5%AE%9A%E4%B9%89%E5%B1%9E%E6%80%A7%E7%9A%84%E7%AE%80%E5%8D%95%E4%BD%BF%E7%94%A8"><span class="toc-number">1.0.35.</span> <span class="toc-text">35【自定义属性】🍋CSS自定义属性的简单使用</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#36%E3%80%90min-content-x2F-max-content%E3%80%91%F0%9F%8D%8D%E5%8F%AF%E4%BB%A5%E8%AE%BE%E7%BD%AE%E5%AE%BD%E5%BA%A6%E4%B8%BAmin-content%E5%92%8Cmax-content%EF%BC%8C%E5%89%8D%E8%80%85%E8%AE%A9%E5%86%85%E5%AE%B9%E5%B0%BD%E5%8F%AF%E8%83%BD%E5%9C%B0%E6%94%B6%E7%BC%A9%EF%BC%8C%E5%90%8E%E8%80%85%E8%AE%A9%E5%86%85%E5%AE%B9%E5%B0%BD%E5%8F%AF%E8%83%BD%E5%9C%B0%E5%B1%95%E5%BC%80"><span class="toc-number">1.0.36.</span> <span class="toc-text">36【min-content&#x2F;max-content】🍍可以设置宽度为min-content和max-content，前者让内容尽可能地收缩，后者让内容尽可能地展开</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#37%E3%80%90%E8%BF%9B%E5%BA%A6%E6%9D%A1%E3%80%91%F0%9F%8D%8A%E4%BD%BF%E7%94%A8%E6%B8%90%E5%8F%98%EF%BC%8C%E4%B8%80%E4%B8%AAdiv%E5%AE%9E%E7%8E%B0%E8%BF%9B%E5%BA%A6%E6%9D%A1"><span class="toc-number">1.0.37.</span> <span class="toc-text">37【进度条】🍊使用渐变，一个div实现进度条</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#38%E3%80%90%E6%89%93%E5%8D%B0%E3%80%91%F0%9F%8D%89%E5%8F%AF%E4%BB%A5%E5%9C%A8%E6%89%93%E5%8D%B0%E7%BD%91%E9%A1%B5%E6%97%B6%EF%BC%8C%E8%AE%BE%E7%BD%AEpage%E7%9B%B8%E5%85%B3%E5%B1%9E%E6%80%A7%E3%80%82%E6%AF%94%E5%A6%82page-break-before%E5%B1%9E%E6%80%A7%E6%9D%A5%E8%A1%A8%E7%A4%BA%E6%98%AF%E5%90%A6%E9%9C%80%E8%A6%81%E5%8F%A6%E8%B5%B7%E6%96%B0%E9%A1%B5"><span class="toc-number">1.0.38.</span> <span class="toc-text">38【打印】🍉可以在打印网页时，设置page相关属性。比如page-break-before属性来表示是否需要另起新页</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#39%E3%80%90%E9%80%90%E5%B8%A7%E5%8A%A8%E7%94%BB%E3%80%91%F0%9F%8D%8C%E5%88%A9%E7%94%A8CSS%E7%B2%BE%E7%81%B5%E5%AE%9E%E7%8E%B0%E9%80%90%E5%B8%A7%E5%8A%A8%E7%94%BB"><span class="toc-number">1.0.39.</span> <span class="toc-text">39【逐帧动画】🍌利用CSS精灵实现逐帧动画</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#40%E3%80%90resize%E3%80%91%F0%9F%8D%90%E6%99%AE%E9%80%9A%E5%85%83%E7%B4%A0%E4%B9%9F%E5%8F%AF%E4%BB%A5%E5%83%8Ftextarea%E9%82%A3%E6%A0%B7resize"><span class="toc-number">1.0.40.</span> <span class="toc-text">40【resize】🍐普通元素也可以像textarea那样resize</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#41%E3%80%90%E9%9D%A2%E5%8C%85%E5%B1%91%E3%80%91%F0%9F%8D%87%E4%BD%BF%E7%94%A8before%E4%BC%AA%E5%85%83%E7%B4%A0%E5%AE%9E%E7%8E%B0%E9%9D%A2%E5%8C%85%E5%B1%91"><span class="toc-number">1.0.41.</span> <span class="toc-text">41【面包屑】🍇使用before伪元素实现面包屑</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#42%E3%80%90sticky-footer%E3%80%91%F0%9F%8D%88%E4%BD%BF%E7%94%A8grid%E5%B8%83%E5%B1%80%E5%AE%9E%E7%8E%B0sticky-footer"><span class="toc-number">1.0.42.</span> <span class="toc-text">42【sticky footer】🍈使用grid布局实现sticky footer</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#43%E3%80%90%E5%8A%A8%E7%94%BB%E5%A1%AB%E5%85%85%E7%8A%B6%E6%80%81%E3%80%91%F0%9F%8D%85CSS%E5%8F%AF%E4%BB%A5%E8%AE%BE%E7%BD%AE%E5%8A%A8%E7%94%BB%E5%BC%80%E5%A7%8B%E5%89%8D%E5%92%8C%E7%BB%93%E6%9D%9F%E6%97%B6%E6%89%80%E4%BF%9D%E6%8C%81%E7%9A%84%E7%8A%B6%E6%80%81"><span class="toc-number">1.0.43.</span> <span class="toc-text">43【动画填充状态】🍅CSS可以设置动画开始前和结束时所保持的状态</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#44%E3%80%90%E5%8A%A8%E7%94%BB%E8%B4%9F%E5%BB%B6%E8%BF%9F%E3%80%91%F0%9F%A5%91CSS%E5%8A%A8%E7%94%BB%E5%8F%AF%E4%BB%A5%E8%AE%BE%E7%BD%AE%E5%BB%B6%E8%BF%9F%E6%97%B6%E9%97%B4%E4%B8%BA%E8%B4%9F%E6%95%B0%EF%BC%8C%E8%A1%A8%E7%A4%BA%E5%8A%A8%E7%94%BB%E4%BB%BF%E4%BD%9B%E5%BC%80%E5%A7%8B%E5%89%8D%E5%B0%B1%E5%B7%B2%E7%BB%8F%E8%BF%90%E8%A1%8C%E8%BF%87%E4%BA%86%E9%82%A3%E4%B9%88%E9%95%BF%E6%97%B6%E9%97%B4"><span class="toc-number">1.0.44.</span> <span class="toc-text">44【动画负延迟】🥑CSS动画可以设置延迟时间为负数，表示动画仿佛开始前就已经运行过了那么长时间</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#45%E3%80%90%E8%BF%87%E6%B8%A1%E3%80%91%F0%9F%8D%86%E7%88%B1%E7%9A%84%E9%AD%94%E5%8A%9B%E8%BD%AC%E5%9C%88%E5%9C%88"><span class="toc-number">1.0.45.</span> <span class="toc-text">45【过渡】🍆爱的魔力转圈圈</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#46%E3%80%90%E5%8A%A8%E7%94%BB%E6%A1%88%E4%BE%8B%E3%80%91%F0%9F%8D%AC%E6%B0%B4%E6%B3%A2%E6%95%88%E6%9E%9C%E5%8E%9F%E7%90%86"><span class="toc-number">1.0.46.</span> <span class="toc-text">46【动画案例】🍬水波效果原理</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#47%E3%80%90%E5%8A%A8%E7%94%BB%E6%A1%88%E4%BE%8B%E3%80%91%F0%9F%8C%B8CSS%E5%BC%B9%E7%90%83%E5%8A%A8%E7%94%BB%E6%95%88%E6%9E%9C%E7%9A%84%E5%8E%9F%E7%90%86"><span class="toc-number">1.0.47.</span> <span class="toc-text">47【动画案例】🌸CSS弹球动画效果的原理</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#48%E3%80%90outline%E3%80%91%F0%9F%8C%BBoutline%E5%B1%9E%E6%80%A7%E7%9A%84%E5%A6%99%E7%94%A8"><span class="toc-number">1.0.48.</span> <span class="toc-text">48【outline】🌻outline属性的妙用</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#49%E3%80%90grid%E3%80%91%F0%9F%92%95%E7%81%AB%E7%8B%90%E6%B5%8F%E8%A7%88%E5%99%A8grid%E5%B8%83%E5%B1%80%E6%A3%80%E6%B5%8B%E5%99%A8"><span class="toc-number">1.0.49.</span> <span class="toc-text">49【grid】💕火狐浏览器grid布局检测器</span></a></li></ol></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>Recent Post</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2022/10/12/04-%E5%89%8D%E7%AB%AF%EF%BC%88%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96%E7%AF%87%EF%BC%89/%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96%E7%AF%87/" title="性能优化面试题"><img src= "" data-lazy-src="/img/%E5%A4%A9%E7%A9%BA.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="性能优化面试题"/></a><div class="content"><a class="title" href="/2022/10/12/04-%E5%89%8D%E7%AB%AF%EF%BC%88%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96%E7%AF%87%EF%BC%89/%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96%E7%AF%87/" title="性能优化面试题">性能优化面试题</a><time datetime="2022-10-12T12:01:36.000Z" title="Created 2022-10-12 20:01:36">2022-10-12</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/10/11/05-%E6%A0%B8%E5%BF%83js%EF%BC%88%E6%96%B9%E6%B3%95%E5%AE%B6%E8%A7%84%EF%BC%89/JS%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%96%B9%E6%B3%95%E2%80%94%E2%80%94%E9%80%9F%E8%AE%B0%E5%B0%8F%E6%9C%AC%E5%AD%90/" title="JS字符串方法"><img src= "" data-lazy-src="/img/%E5%A4%A9%E7%A9%BA.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="JS字符串方法"/></a><div class="content"><a class="title" href="/2022/10/11/05-%E6%A0%B8%E5%BF%83js%EF%BC%88%E6%96%B9%E6%B3%95%E5%AE%B6%E8%A7%84%EF%BC%89/JS%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%96%B9%E6%B3%95%E2%80%94%E2%80%94%E9%80%9F%E8%AE%B0%E5%B0%8F%E6%9C%AC%E5%AD%90/" title="JS字符串方法">JS字符串方法</a><time datetime="2022-10-11T12:01:36.000Z" title="Created 2022-10-11 20:01:36">2022-10-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/10/11/05-%E6%A0%B8%E5%BF%83js%EF%BC%88%E6%96%B9%E6%B3%95%E5%AE%B6%E8%A7%84%EF%BC%89/JS%E5%AF%B9%E8%B1%A1%E6%96%B9%E6%B3%95%E2%80%94%E2%80%94%E9%80%9F%E8%AE%B0%E5%B0%8F%E6%9C%AC%E5%AD%90/" title="JS对象方法"><img src= "" data-lazy-src="/img/%E5%A4%A9%E7%A9%BA.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="JS对象方法"/></a><div class="content"><a class="title" href="/2022/10/11/05-%E6%A0%B8%E5%BF%83js%EF%BC%88%E6%96%B9%E6%B3%95%E5%AE%B6%E8%A7%84%EF%BC%89/JS%E5%AF%B9%E8%B1%A1%E6%96%B9%E6%B3%95%E2%80%94%E2%80%94%E9%80%9F%E8%AE%B0%E5%B0%8F%E6%9C%AC%E5%AD%90/" title="JS对象方法">JS对象方法</a><time datetime="2022-10-11T12:01:36.000Z" title="Created 2022-10-11 20:01:36">2022-10-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/10/11/05-%E6%A0%B8%E5%BF%83js%EF%BC%88%E6%96%B9%E6%B3%95%E5%AE%B6%E8%A7%84%EF%BC%89/JS%E6%95%B0%E7%BB%84%E6%96%B9%E6%B3%95%E2%80%94%E2%80%94%E9%80%9F%E6%9F%A5%E5%B0%8F%E6%9C%AC%E5%AD%90/" title="JS数组方法"><img src= "" data-lazy-src="/img/%E5%A4%A9%E7%A9%BA.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="JS数组方法"/></a><div class="content"><a class="title" href="/2022/10/11/05-%E6%A0%B8%E5%BF%83js%EF%BC%88%E6%96%B9%E6%B3%95%E5%AE%B6%E8%A7%84%EF%BC%89/JS%E6%95%B0%E7%BB%84%E6%96%B9%E6%B3%95%E2%80%94%E2%80%94%E9%80%9F%E6%9F%A5%E5%B0%8F%E6%9C%AC%E5%AD%90/" title="JS数组方法">JS数组方法</a><time datetime="2022-10-11T12:01:36.000Z" title="Created 2022-10-11 20:01:36">2022-10-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2022/10/11/07-%E6%A0%B8%E5%BF%83js%EF%BC%88%E6%89%8B%E5%86%99%E7%AF%87%EF%BC%89/%E5%BC%80%E5%8F%91%E5%B0%81%E8%A3%85%E5%87%BD%E6%95%B0/" title="开发封装函数"><img src= "" data-lazy-src="/img/%E5%A4%A9%E7%A9%BA.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="开发封装函数"/></a><div class="content"><a class="title" href="/2022/10/11/07-%E6%A0%B8%E5%BF%83js%EF%BC%88%E6%89%8B%E5%86%99%E7%AF%87%EF%BC%89/%E5%BC%80%E5%8F%91%E5%B0%81%E8%A3%85%E5%87%BD%E6%95%B0/" title="开发封装函数">开发封装函数</a><time datetime="2022-10-11T12:01:36.000Z" title="Created 2022-10-11 20:01:36">2022-10-11</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2022 By 孙志豪</div><div class="framework-info"><span>Framework </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>Theme </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="Read Mode"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="Switch Between Light And Dark Mode"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="Toggle between single-column and double-column"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="Setting"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="Table Of Contents"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="Back To Top"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">Search</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  Loading the Database</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="Search for Posts" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.min.js"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="/js/search/local-search.js"></script><div class="js-pjax"></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>